package com.augurit.common.dao;

import org.springframework.stereotype.Repository;

import com.augurit.common.base.dao.BaseDao;
import com.augurit.common.entity.AtLoginCheck;
import com.augurit.common.system.web.org.form.AtLoginCheckForm;

/**
 * 登录检测DAO类
 */
@Repository
public class AtLoginCheckDao extends BaseDao<AtLoginCheck, Long> {

	public AtLoginCheckForm getForm(Long id){
		AtLoginCheckForm form = null;
		
		if(id != null){
			AtLoginCheck entity = this.get(id);
//			if(entity != null)
//				form = (AtLoginCheckForm)DozerUtils.map(entity, AtLoginCheckForm.class);
		}

		return form;
	}
	
	/**
	 * 保存登录检测Form对象
	 * @param form 登录检测Form对象
	 */
	public void save(AtLoginCheckForm form){
		
		if(form != null){
			AtLoginCheck entity = null;
			
			//准备VO对象
			if(form != null && form.getCheckId() != null){
				entity = this.get(form.getCheckId());
			}else{
				entity = new AtLoginCheck();
			}
			
			//属性值转换
//			DozerUtils.map(form, entity);
			
			//保存
			super.save(entity);
			
			//回填ID属性值
			form.setCheckId(entity.getCheckId());
		}
	}

}
